package org.example.compare.dto;

import lombok.Data;

import java.util.*;

@Data
public class OrderDto {
    public String mLocalOrderNum;
    public String mOuterOrderNum;
    public String mRemark;
    public String mLineColorNum;
    public Long mLocalStyleId; //款式id
    public String mOuterStyleNum;
    //    public String mGroupName;
//    public String mGroup2Name;
    public List<Long> groupIds = Collections.emptyList(); //组别id列表
    public String mCustomer;
    public String mColorShader;
    public String mColor;
    public Date mTimeOfOperation; //操作时间（投产时间）
    public int miOrderStatus;
    public Date mDeadLine;  //交期
    public Date mPredictFinishTime;
    public Date mRealFinishTime;
    public double mfProgress; //进度
    public int miFinishedCnt;
    public boolean mbCompletedFlag;
    public boolean mbDiyFlag;
    public double mfOrderCoef;
    public boolean mbPriFlag;//急单标记
    public int miHourTarget;//小时需完成件数
    public int miNow2DeadlineSecs;//从现在到货期的秒数，按照假期工作日实时计算
    public int miOperate2Deadline;//从投产日到货期的秒数，按照假期工作日实时计算
    public int miFeededBoxCnt;//进料筐数累计
    public double mfGSTTotalTime;
    public boolean mbValidFlag;
    public int miLimitSecs;//加人阈值，没有显示，默认7200
    public int miDeadLineGroup;//货期组别，从1开始排列，COrderRecord没有
    public Integer firstPerBox; //首筐件数
    public Integer qtyPerBox; //每筐件数
    public Map<Long, Map<Integer, OrderProcess>> mOrderProcessSetGroupByPart = new HashMap<>();//按部件分组的订单工序，向量内部需要按顺序排好
    //如果部件先没有工序，说明这个部件的工序有问题，需要处理

    public Map<Long, List<SBoxData>> mCurBoxSetGroupByPart = new HashMap<>();//按部件分组的当前筐，内部按照尺码id，计划开始裁片排序好
    public int miTotalPlanCnt;//订单的总件数

    public OrderDto() {
    }

    public static OrderDto InitOrder() {
        OrderDto pInOut = new OrderDto();
        pInOut.mbCompletedFlag = false;
        pInOut.mbDiyFlag = false;
        pInOut.mbValidFlag = false;
        pInOut.mColor = "";
        pInOut.mColorShader = "";
        pInOut.mCustomer = "";
        pInOut.mDeadLine = new Date(0);
        pInOut.mfGSTTotalTime = 0.0f;
        pInOut.mfOrderCoef = 0.0f;
        pInOut.mfProgress = 0.0f;
        pInOut.miDeadLineGroup = -1;
        pInOut.miFeededBoxCnt = 0;
        pInOut.miFinishedCnt = 0;
        pInOut.miHourTarget = 0;
        pInOut.miLimitSecs = 7200;
        pInOut.miOrderStatus = 0;
        pInOut.mLineColorNum = "";
        pInOut.mLocalOrderNum = "";
        pInOut.mLocalStyleId = 0L;
        pInOut.mOuterOrderNum = "";
        pInOut.mOuterStyleNum = "";
        pInOut.mPredictFinishTime = new Date(0);
        pInOut.mRealFinishTime = new Date(0);
        pInOut.mRemark = "";
        pInOut.mTimeOfOperation = new Date(0);
        pInOut.miNow2DeadlineSecs = 0;
        pInOut.miOperate2Deadline = 0;
        pInOut.miTotalPlanCnt = 0;
        return pInOut;
    }

    public void clear() {
        for (Map<Integer, OrderProcess> orderProcessList : mOrderProcessSetGroupByPart.values()) {
            orderProcessList.clear();
        }
        mOrderProcessSetGroupByPart.clear();
        for (List<SBoxData> orderProcessList : mCurBoxSetGroupByPart.values()) {
            orderProcessList.clear();
        }
        mCurBoxSetGroupByPart.clear();
    }

}
